<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--<%@ taglib prefix="pg" uri="http://jsptags.com/tags/navigation/pager" %>--%>

<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/6/9
  Time: 10:26
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%
  String path = request.getContextPath();
  String basePath = request.getScheme() + "://"
          + request.getServerName() + ":" + request.getServerPort()
          + path + "/";
%>
<html>
<head>
    <title>Show All User Page!</title>
    <style>
      a{
        text-decoration: none;
        color:#31a425;
      }

      /*a:hover{*/
        /*color:#000;*/
        /*font-size: 20px;*/
      /*}*/

      a.hover{
        color:#fff;
        font-size: 14px;
      }
      td{
        width:100px;
        text-align: center;
        height:50px;

      }
      .div{
        margin-top: 10px;
        width:1200px;height:560px;
        border: 1px solid #ccc;
        margin-left: 50px;
        background-color: #edf8fe;
      }
      body{
        background-image:url(../../resources/image/1.jpg)
      }

      table{
        margin-left: 50px;
        width:90%;
        margin-top: 10px;
      }
      span{
        margin-left: 500px;
        font-size: 20px;
        color:#fff;
      }
      .find{
        width:60px;height:30px;margin-left: 30px;background-color:#1e8b10;border: 1px solid #1e8b10;color:#fff;line-height: 30px;
      }
      .find_name{
        height:30px;margin-left: 100px;margin-top: 20px;border-radius: 5%;
      }
      .font-size20{
        font-size: 20px;color:#34852b;
      }
      .add{
        width:60px;height:30px;margin-left: 400px;background-color:#1e8b10;margin-top:-47px;
        text-align: center;
        line-height: 30px;
      }
    </style>
  <meta http-equiv="Content-Type" content="text/html charset=utf-8">
  <% response.setContentType("text/html;charset=UTF-8");%>
  <% request.setCharacterEncoding("utf-8");%>
</head>
<body>
<span>学生信息管理系统</span>
<div class="div">
  <form action="/user/findUser" method="post">
    <input type="text" name="name" class="find_name">
    <input class="find"  type="submit" value="查询"/>
  </form>
  <span class="add" style="display: inline-block"><a class="hover" href="/user/add">添加</a></span>
<table>
  <%--<tr>--%>
    <%--<td style="text-align: center; " colspan="6">--%>
      <%----%>
    <%--</td>--%>
  <%--</tr>--%>
  <tr>
    <td class="font-size20">学生序号</td>
    <td class="font-size20">用户名</td>
    <td class="font-size20">密码</td>
    <td class="font-size20">个人简介</td>
    <td class="font-size20">编辑</td>
    <td class="font-size20">删除</td>
  </tr>
  <%--这里需要注意的是items里面放的变量为数据的总的来源存放空间----%>
  <c:forEach items="${recordList}" var="us">
    <tr>
        <%--us.username注意这里username属性是从list集合里面从数据库查询而来，所以要根据数据库的属性来取值--%>
      <td><c:out value="${us.userId}"/></td>
      <td><c:out value="${us.username}"/></td>
      <td style="width:120px"><c:out value="${us.password}"/></td>
      <td style="width: 400px;text-align: left"><c:out value="${us.description}"/></td>
      <td><a href="/user/users/${us.userId}">修改</a></td>
      <td><a href="/user/delete/${us.userId}">删除</a></td>
    </tr>
  </c:forEach>
    <tr>
      <td colspan="6">
        <!-- 分页功能 start -->
        <div align="center">
          <font size="2">共 ${page.totalPageCount} 页</font> <font size="2">第
          ${page.pageNow} 页</font> <a href="/user${pageContext.request.contextPath}/queryAll?pageNow=1">首页</a>
          <c:choose>
          <c:when test="${page.pageNow - 1 > 0}">
          <a href="/user${pageContext.request.contextPath}/queryAll?pageNow=${page.pageNow - 1}">上一页</a>
          </c:when>
          <c:when test="${page.pageNow - 1 <= 0}">
          <a href="/user${pageContext.request.contextPath}/queryAll?pageNow=1">上一页</a>
          </c:when>
          </c:choose>
          <c:choose>
          <c:when test="${page.totalPageCount==0}">
          <a href="/user${pageContext.request.contextPath}/queryAll?pageNow=${page.pageNow}">下一页</a>
          </c:when>
          <c:when test="${page.pageNow + 1 < page.totalPageCount}">
          <a href="/user${pageContext.request.contextPath}/queryAll?pageNow=${page.pageNow + 1}">下一页</a>
          </c:when>
          <c:when test="${page.pageNow + 1 >= page.totalPageCount}">
          <a href="/user${pageContext.request.contextPath}/queryAll?pageNow=${page.totalPageCount}">下一页</a>
          </c:when>
          </c:choose>
          <c:choose>
          <c:when test="${page.totalPageCount==0}">
          <a href="/user${pageContext.request.contextPath}/queryAll?pageNow=${page.pageNow}">尾页</a>
          </c:when>
          <c:otherwise>
          <a href="/user${pageContext.request.contextPath}/queryAll?pageNow=${page.totalPageCount}">尾页</a>
          </c:otherwise>
          </c:choose>
</div>
          <!-- 分页功能 End -->
      </td>
    </tr>
</table>
  </div>
</body>
</html>
